﻿using System;
using System.Collections.Generic;
using System.Drawing;

namespace GraphDrawing.Graph.Model
{
    public interface ILayoutManager
    {
        Point GetLocation(int index);
    }

    public class ManualLayoutManager : ILayoutManager
    {
        readonly Dictionary<int, Point> positions = new Dictionary<int, Point>();

        public void SetPosition(int index, Point pos)
        {
            positions[index] = pos;
        }

        public Point GetLocation(int index)
        {
            Point p;
            if (!positions.TryGetValue(index, out p))
                throw new InvalidOperationException("slot is not found");
            return p;
        }
    }
}